package com.lmx.repoDomain.tmodel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.lmx.repoDomain.tmodel.business.User;
import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 用药计划统计子表，用于存放具体药品
 */
@JsonApiResource(type = "customerdrugreportitem")
@Table(name = "tnb_customer_drug_report_item")
@Entity
public class CustomerDrugReportItem extends BaseEntity {
	private String remark;// 备注

	private User lastUpdateUser;// 更新操作者userid

	private Integer createDateTime;// 创建时间

	private User createUser;

	private Integer lastUpdateDateTime;// 更新时间

	private String drugFactory;// 生产厂家
	
	private String drugName;// 药品名
	
	private String customerName;// 老人名
	
	private String cardCode;// 老人身份证
	
	private CustomerDrugReport report;
	
	private CustomerDrug customerDrug;
	
	private Customer customer;

	private Double currDrugNum;	// 当前数量
	
	private Integer leftDays;	// 剩余天数
	
	public Double getCurrDrugNum() {
		return currDrugNum;
	}

	public void setCurrDrugNum(Double currDrugNum) {
		this.currDrugNum = currDrugNum;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
    @JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "customerdrugreport_id", foreignKey = @ForeignKey(name = "null"))
	public CustomerDrugReport getReport() {
		return report;
	}

	public void setReport(CustomerDrugReport report) {
		this.report = report;
	}

	public CustomerDrugReportItem() {

	}

	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}

	@JsonApiToOne
	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	@JsonApiToOne
	public User getLastUpdateUser() {
		return lastUpdateUser;
	}

	public void setLastUpdateUser(User lastUpdateUser) {
		this.lastUpdateUser = lastUpdateUser;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@Column(name = "drug_factory")
	public String getDrugFactory() {
		return drugFactory;
	}

	public void setDrugFactory(String drugFactory) {
		this.drugFactory = drugFactory;
	}
	
	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
    @JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "leftDays")
	public Integer getLeftDays() {
		return leftDays;
	}

	public void setLeftDays(Integer leftDays) {
		this.leftDays = leftDays;
	}
	
	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
    @JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "customerdrug_id", foreignKey = @ForeignKey(name = "null"))
	public CustomerDrug getCustomerDrug() {
		return customerDrug;
	}

	public void setCustomerDrug(CustomerDrug customerDrug) {
		this.customerDrug = customerDrug;
	}
	
	@Column(name = "drugName")
	public String getDrugName() {
		return drugName;
	}

	public void setDrugName(String drugName) {
		this.drugName = drugName;
	}

	@Column(name = "customerName")
	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	@Column(name = "cardCode")
	public String getCardCode() {
		return cardCode;
	}

	public void setCardCode(String cardCode) {
		this.cardCode = cardCode;
	}

}
